package com.bjpowernode.springboot.config;

import com.bjpowernode.springboot.filter.MyFiter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration //定义此类为配置类
public class MyFilterConfig {

    @Bean
    public FilterRegistrationBean myFilterRegistrationBean(){
        //注册过滤器
        FilterRegistrationBean bean=new FilterRegistrationBean(new MyFiter());
        //添加过滤路径
        bean.addUrlPatterns("/user/*");
        return bean;
    }
}
